package com.baidu.mapapi;

import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
import android.widget.Toast;
import java.util.ArrayList;

public class PoiOverlay extends ItemizedOverlay<OverlayItem>
{
  private MapView a = null;
  private Context b = null;
  private int c = 1;
  public ArrayList<MKPoiInfo> mList = null;
  public boolean mUseToast = true;

  public PoiOverlay(Activity paramActivity, MapView paramMapView)
  {
    super(null);
    this.b = paramActivity;
    this.a = paramMapView;
    DisplayMetrics localDisplayMetrics = new DisplayMetrics();
    paramActivity.getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);
    if (Mj.i <= 120)
    {
      this.c = 0;
      return;
    }
    if (Mj.i <= 180)
    {
      this.c = 1;
      return;
    }
    this.c = 2;
  }

  public void animateTo()
  {
    if (size() > 0)
      onTap(0);
  }

  protected OverlayItem createItem(int paramInt)
  {
    char[] arrayOfChar1 = { 97, 98, 99, 100, 101, 102, 103, 104, 105, 106 };
    char[] arrayOfChar2 = { 108, 109, 104 };
    MKPoiInfo localMKPoiInfo = (MKPoiInfo)this.mList.get(paramInt);
    OverlayItem localOverlayItem = new OverlayItem(localMKPoiInfo.pt, localMKPoiInfo.name, localMKPoiInfo.address);
    Drawable localDrawable = null;
    if (paramInt < 10)
    {
      StringBuilder localStringBuilder = new StringBuilder(32);
      localStringBuilder.append("icon_mark").append(arrayOfChar1[paramInt]).append('_').append(arrayOfChar2[this.c]).append(".png");
      localDrawable = k.a(this.b, localStringBuilder.toString());
    }
    localOverlayItem.setMarker(boundCenterBottom(localDrawable));
    return localOverlayItem;
  }

  public MKPoiInfo getPoi(int paramInt)
  {
    if (this.mList == null)
      return null;
    return (MKPoiInfo)this.mList.get(paramInt);
  }

  protected boolean onTap(int paramInt)
  {
    OverlayItem localOverlayItem = getItem(paramInt);
    this.a.getController().animateTo(localOverlayItem.mPoint);
    if ((this.mUseToast) && (localOverlayItem.mTitle != null))
      Toast.makeText(this.b, localOverlayItem.mTitle, 1).show();
    super.onTap(paramInt);
    return true;
  }

  public void setData(ArrayList<MKPoiInfo> paramArrayList)
  {
    if (paramArrayList != null)
    {
      this.mList = paramArrayList;
      super.populate();
    }
  }

  public int size()
  {
    int i = 10;
    if (this.mList == null)
      i = 0;
    while (this.mList.size() > i)
      return i;
    return this.mList.size();
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.baidu.mapapi.PoiOverlay
 * JD-Core Version:    0.6.2
 */